:root {
    --modal-bg: #222222;
    --modal-border: #444444;
    --modal-text: #ffffff;
    --modal-text-muted: #888888;
    --modal-text-secondary: #cccccc;
    --modal-input-bg: #222222;
    --modal-input-border: #555555;
    --modal-input-focus: #656565;
    --modal-button-primary: #4CAF50;
    --modal-button-primary-hover: #45a049;
    --modal-button-primary-active: #3d8b40;
    --modal-button-danger: #8b0000;
    --modal-button-danger-hover: #dc3545;
    --modal-button-danger-active: #721c24;
    --modal-button-secondary: #666666;
    --modal-button-secondary-hover: #777777;
    --modal-shadow: rgba(0, 0, 0, 0.3);
    --modal-shadow-strong: rgba(0, 0, 0, 0.7);
    --modal-transition: 0.2s ease-out;
    --modal-spacing: 20px;
    --modal-spacing-sm: 10px;
    --modal-spacing-xs: 5px;
    --modal-border-radius: 4px;
}

.dn_modal {
    width: 50% !important;
    overflow: visible !important;
}

.text-editor-modal {
    padding: var(--modal-spacing);
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 600px;
    min-height: 500px;
    height: 100%;
    position: relative;
}

.text-editor-main-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    min-width: 0;
}

.dn_modal .dn_close_button {
    z-index: 50;
    pointer-events: auto;
    position: absolute;
}

.dn_modal .dn_close_button svg {
    width: 26px;
    height: 26px;
    stroke-width: 1;
    color: #9b9b9b;
    transition: transform var(--modal-transition), color var(--modal-transition);
    transform: scale(1);
}

.dn_modal .dn_close_button:hover svg {
    transform: scale(1.2);
    color: var(--modal-text);
}

.text-editor-sidebar {
    position: absolute;
    top: var(--modal-spacing);
    left: 100%;
    width: 0;
    height: calc(100% - var(--modal-spacing));
    background-color: var(--modal-bg);
    transition: width 0.15s ease-out;
    z-index: 1;
    padding: 0;
    margin: 0;
    pointer-events: none;
    overflow: hidden;
}

.text-editor-sidebar-content {
    position: absolute;
    left: 0;
    top: 0;
    width: 320px;
    padding: 0;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.15s ease-out;
    transition-delay: 0s;
    display: flex;
    flex-direction: column;
}

.wildcard-controls {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 0;
}

.sidebar-buttons-container {
    background-color: #1a1a1a;
    padding: var(--modal-spacing-sm) var(--modal-spacing) var(--modal-spacing-sm) var(--modal-spacing);
    box-shadow: 0 var(--modal-spacing-xs) var(--modal-spacing-sm) calc(-1 * var(--modal-spacing-xs)) var(--modal-shadow-strong);
    flex-shrink: 0;
    margin: 0;
    position: relative;
    z-index: 1;
}

.wildcard-dropdowns {
    display: flex;
    flex-direction: column;
    gap: var(--modal-spacing-sm);
    padding: var(--modal-spacing-sm) var(--modal-spacing) var(--modal-spacing) var(--modal-spacing);
    overflow-y: auto;
    flex: 1;
}

.text-editor-sidebar.expanded {
    width: 320px;
    pointer-events: auto;
}
/* 
.text-editor-sidebar.expanded::before,
.text-editor-sidebar.expanded::after,
.text-editor-sidebar.expanded::left {
    content: '';
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

.text-editor-sidebar.expanded::before {
    top: 0;
    left: 0;
    width: 100%;
    height: var(--modal-spacing);
    background: linear-gradient(to bottom, rgba(34, 34, 34, 0.9) 0%, transparent 100%);
    box-shadow: inset 0 var(--modal-spacing) var(--modal-spacing) calc(-1 * var(--modal-spacing)) var(--modal-shadow-strong);
}

.text-editor-sidebar.expanded::after {
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--modal-spacing);
    background: linear-gradient(to top, rgba(34, 34, 34, 0.9) 0%, transparent 100%);
    box-shadow: inset 0 calc(-1 * var(--modal-spacing)) var(--modal-spacing) calc(-1 * var(--modal-spacing)) var(--modal-shadow-strong);
} */

.text-editor-sidebar.expanded {
    box-shadow: inset var(--modal-spacing) 0 var(--modal-spacing) calc(-1 * var(--modal-spacing)) var(--modal-shadow-strong);
}

.text-editor-sidebar.expanded .text-editor-sidebar-content {
    opacity: 1;
    transition-delay: 0.1s;
}

.text-editor-file-path {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--modal-text);
    margin-bottom: var(--modal-spacing-xs);
    padding: var(--modal-spacing-xs) 0;
}

.text-editor-path {
    color: var(--modal-text-muted);
}

.text-editor-filename {
    color: var(--modal-text);
}

.text-editor-textarea {
    width: 100%;
    height: calc(75vh);
    font-family: 'Courier New', monospace;
    font-size: 0.8em;
    border: 1px solid var(--modal-input-border);
    padding: var(--modal-spacing-sm);
    resize: none;
    background-color: var(--modal-input-bg);
    color: var(--modal-text);
    line-height: 1.4;
    transition: border-color var(--modal-transition), box-shadow var(--modal-transition);
}

.text-editor-textarea:focus {
    outline: none;
    border-color: var(--modal-input-focus);
    box-shadow: 0 0 var(--modal-spacing-xs) var(--modal-shadow);
}

.text-editor-save-button {
    padding: var(--modal-spacing-sm) var(--modal-spacing);
    background-color: var(--modal-button-primary);
    color: white;
    border: none;
    border-radius: var(--modal-border-radius);
    cursor: pointer;
    align-self: flex-end;
    font-size: 1em;
    font-weight: 500;
    transition: all var(--modal-transition);
    min-width: 100px;
}

.text-editor-save-button:hover {
    background-color: var(--modal-button-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.text-editor-save-button:active {
    background-color: var(--modal-button-primary-active);
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(76, 175, 80, 0.3);
}

.text-editor-save-button:disabled,
.text-editor-save-button:disabled:hover,
.text-editor-save-button:disabled:active {
    background-color: var(--modal-button-secondary) !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    pointer-events: none !important;
}

.sidebar-buttons-container .wildcard-reset-button,
.sidebar-buttons-container .wildcard-save-button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: var(--modal-border-radius);
    cursor: pointer;
    font-size: 0.9em;
}

.wildcard-reset-button {
    background-color: var(--modal-button-secondary);
    color: white;
}

.wildcard-save-button {
    background-color: var(--modal-button-primary);
    color: white;
}

.wildcard-reset-button:hover {
    background-color: var(--modal-button-secondary-hover);
}

.wildcard-save-button:hover {
    background-color: var(--modal-button-primary-hover);
}

.wildcard-dropdown {
    display: none;
}

.custom-dropdown {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
}

.custom-dropdown-button {
    width: 100%;
    padding: 6px 8px;
    background: rgba(20, 20, 20, 0.98);
    color: #ccc;
    border: none;
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
    text-align: left;
    position: relative;
    padding-right: 32px;
    transition: background-color var(--modal-transition);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-dropdown-button:hover {
    background: rgba(30, 30, 30, 0.98);
}

.custom-dropdown-button:focus {
    outline: none;
    background: rgba(30, 30, 30, 0.98);
}

.custom-dropdown-arrow {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.2s ease;
    pointer-events: none;
    color: #ccc;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-dropdown.open .custom-dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.custom-dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(20, 20, 20, 0.98);
    border-radius: 4px;
    margin-top: 2px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.custom-dropdown.open .custom-dropdown-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-dropdown-option {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    color: #ccc;
    border: none;
    font-size: 0.9em;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.custom-dropdown-option:hover {
    background: rgba(40, 40, 40, 0.98);
}

.custom-dropdown-option.selected {
    background: rgba(50, 50, 50, 0.98);
    color: #fff;
}

.custom-dropdown-option.not-selected {
    color: #999;
    font-style: italic;
}

.custom-dropdown-options::-webkit-scrollbar {
    width: 6px;
}

.custom-dropdown-options::-webkit-scrollbar-track {
    background: rgba(40, 40, 40, 0.5);
    border-radius: 3px;
}

.custom-dropdown-options::-webkit-scrollbar-thumb {
    background: rgba(80, 80, 80, 0.8);
    border-radius: 3px;
}

.custom-dropdown-options::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 100, 100, 0.8);
}

.wildcard-dropdown-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
}

.wildcard-dropdown-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    position: relative;
}

.wildcard-label {
    font-family: 'Courier New', monospace;
    font-size: 0.8em;
    color: var(--modal-text-secondary);
    background-color: #333;
    padding: 4px 8px;
    border-radius: 3px;
    transition: background-color 0.15s ease-out;
    user-select: none;
}

.wildcard-label.flash-update {
    background-color: #428545;
    transition: background-color 0.15s ease-out;
}

.wildcard-label.flash-reset {
    background-color: #a44f4f;
    transition: background-color 0.15s ease-out;
}

.wildcard-label.unsaved-selection {
    background-color: #B8860B;
    color: white;
    transition: background-color 0.15s ease-out;
}

.wildcard-label svg {
    width: 13px;
    height: 13px;
    vertical-align: middle;
    margin: 0 4px;
}

.no-wildcards-message {
    color: var(--modal-text-muted);
    font-style: italic;
    text-align: center;
    padding: var(--modal-spacing);
}

.wildcard-update-notification {
    background-color: var(--modal-button-primary);
    color: white;
    padding: 8px 12px;
    border-radius: var(--modal-border-radius);
    margin-bottom: var(--modal-spacing-sm);
    font-size: 0.9em;
    text-align: center;
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0% { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
    10% { 
        opacity: 1; 
        transform: translateY(0); 
    }
    90% { 
        opacity: 1; 
        transform: translateY(0); 
    }
    100% { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
}

.wildcard-mark-icon {
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    cursor: pointer;
    margin-left: 6px;
    margin-right: 2px;
    color: #B8860B;
    transition: color 0.15s;
    flex: 0 0 auto;
    height: 100%;
}
.wildcard-mark-icon:hover {
    color: #FFD700;
}

.wildcard-mark-icon.marked {
    color: #4CAF50 !important;
    background: none !important;
    border-radius: 3px;
    padding: 2px;
}


.wildcard-mark-icon.unsaved {
    color: #FFD700 !important;
    background: none !important;
}

.wildcard-mark-tooltip {
    position: absolute;
    background: rgba(20, 20, 20, 0.98);
    color: #ccc;
    padding: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 99999;
    /* Add shadow to bottom and left */
    box-shadow: 0 6px 12px rgba(0,0,0,0.35), -4px 0 8px rgba(0,0,0,0.18);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95) translateY(-5px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
    min-width: 260px;
}

.wildcard-mark-tooltip input[type="text"] {
    background: #444;
    color: #ccc;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.98em;
    outline: none;
    min-width: 200px;
}

.wildcard-mark-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

.wildcard-mark-tooltip input[type="text"] {
    background: #444;
    color: #ccc;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.98em;
    outline: none;
    width: 80px;
}

.wildcard-mark-tooltip button {
    background: #B8860B;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.15s;
}
.wildcard-mark-tooltip button:hover {
    background: #FFD700;
    color: #222;
}

.wildcard-mark-add-icon,
.wildcard-mark-delete-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #999;
    transition: color 0.2s ease;
    cursor: pointer;
}

.wildcard-mark-add-icon:hover {
    color: #4CAF50;
}

.wildcard-mark-delete-icon:hover {
    color: #dc3545;
}

.wildcard-mark-add-icon,
.wildcard-mark-delete-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    margin-right: 2px;
    width: 24px;
    height: 24px;
}

.wildcard-mark-icon {
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    cursor: pointer;
    margin-left: 6px;
    margin-right: 2px;
    color: #999;
    transition: color 0.2s ease;
    flex: 0 0 auto;
    height: 100%;
}

.wildcard-mark-icon:hover {
    color: #fff;
}

.wildcard-mark-icon.marked {
    color: #4CAF50 !important;
    background: none !important;
    border-radius: 3px;
    padding: 2px;
}

.wildcard-mark-icon.marked:hover {
    color: #5CBF60 !important;
}

.wildcard-mark-icon.unsaved {
    color: #FFD700 !important;
    background: none !important;
}

.wildcard-mark-icon.unsaved:hover {
    color: #FFED4E !important;
}

.wildcard-mark-add-icon,
.wildcard-mark-delete-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    margin-right: 2px;
    width: 24px;
    height: 24px;
    color: #999;
    transition: color 0.2s ease;
    cursor: pointer;
}

.wildcard-mark-add-icon:hover,
.wildcard-mark-delete-icon:hover {
    color: #fff;
}

.wildcard-mark-tooltip button {
    background: none !important;
    color: inherit !important;
    border: none !important;
    border-radius: none !important;
    padding: 0 !important;
    cursor: pointer;
    font-size: inherit !important;
    transition: none !important;
}

.wildcard-mark-tooltip button:hover {
    background: none !important;
    color: inherit !important;
}